package com.xtwy.qrcodescan;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.Response;
import com.xtwy.qrcodescan.bean.ResponseBean;
import com.xtwy.qrcodescan.bean.SimpleBean;
import com.xtwy.qrcodescan.callbck.JsonCallback;
import com.xtwy.qrcodescan.net.OkUtil;

import java.util.HashMap;

/*
 * -----------------------------------------------------------------
 * Copyright (C) 2014-2016, by your company, All rights reserved.
 * -----------------------------------------------------------------
 * 文    件: NetActivity.java
 * 作    者: 侯建军
 * 版    权: 1.0.0
 * 描    述: 访问网络
 * 创建时间: 2018/9/14 16:49
 * 更新时间：2018/9/14 16:49
 * -----------------------------------------------------------------
 * 2018/9/14 16:49 : 创建 NetActivity.java (侯建军);
 * -----------------------------------------------------------------
 */
public class NetActivity extends AppCompatActivity {
    private TextView mTv;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_net);
        //获取对象
        mTv = (TextView) findViewById(R.id.tv);
        postRequest();
    }
    private void postRequest() {
        OkUtil.postRequest("http://192.168.1.122:8001/pay/serviceFee/getCurrentRate", this, new HashMap<String, String>(), new JsonCallback<ResponseBean<SimpleBean>>() {
            @Override
            public void onSuccess(Response<ResponseBean<SimpleBean>> response) {
                mTv.setText(response.body().data.getName() + "-" + response.body().data.getHabby());
                Log.d("信息","结果");
            }
        });
    }
}
